package com.itheima.hashset;

import java.util.*;

public class Demo2 {
    public static void main(String[] args) {
        Map<String, ArrayList<String>> map = new HashMap<>();
        ArrayList<String> list1 = new ArrayList<>();
        ArrayList<String> list2 = new ArrayList<>();
        ArrayList<String> list3 = new ArrayList<>();
        ArrayList<String> list4 = new ArrayList<>();
        Collections.addAll(list1, "孙悟空", "唐僧", "猪八戒", "沙僧");
        Collections.addAll(list2, "松江", "武松", "武大郎", "卢俊义");
        Collections.addAll(list3, "诸葛亮", "吕布", "潘凤", "鲁肃");
        Collections.addAll(list4, "林黛玉", "贾宝玉", "刘姥姥", "薛宝钗");
        map.put("西游记", list1);
        map.put("水浒传", list2);
        map.put("三国演义", list3);
        map.put("红楼梦", list4);
        Set<Map.Entry<String, ArrayList<String>>> set = map.entrySet();
        for (Map.Entry<String, ArrayList<String>> stringArrayListEntry : set) {
            String key = stringArrayListEntry.getKey();
            ArrayList<String> value = stringArrayListEntry.getValue();
            System.out.println(key);
            //System.out.println(value);
            for (String s : value) {
                System.out.print(s+"  ");
            }
            System.out.println();
        }

    }
}
